<?php
namespace app\app\model;
use think\Model;
use think\Db;

class UserOrder extends Model{

	public $user_id;

	public function __construct($data){
		parent::__construct();
		$this->user_id = $data;
	}

	public function getUnpaid($page){
		$Num = config('pageNum');
		$pageNum = $Num*($page-1);
		$where['a.user_id'] = array('eq',$this->user_id);
		$where['b.status']  = array('neq',0);
		$data = $this->alias('a')->field('a.create_time,b.id')->join('orders b','a.order_id=b.id','left')->where($where)->limit($pageNum,$Num)->count();
		return $data;
	}

}